package com.v5ba.annotation.web;

import com.v5ba.common.Encrypt;
import com.v5ba.annotation.myannotation.User;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @PostMapping("hello")
    @Encrypt
    public String hello(User user, String name, String age){
        System.out.println("开始");
//        sayHello();
//        sayHello();
        System.out.println("结束");
        return name + age;
    }
    @Async
    public void sayHello(){
        try {
            Thread.sleep(1000*5L);
            System.out.println("线程名称："+Thread.currentThread().getName());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("sayHello");
    }
}

